﻿<UserControl x:Class="Kokomo.PeInspector.Reflection.AssemblyOverviewView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:kui="xaml://kokomo/ui"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
	<UserControl.Resources>
		<Style TargetType="{x:Type Expander}">
			<Setter Property="HeaderTemplate">
				<Setter.Value>
					<DataTemplate>
						<TextBlock FontWeight="Bold" Text="{Binding}"/>
					</DataTemplate>
				</Setter.Value>
			</Setter>
			<Setter Property="ContentTemplate">
				<Setter.Value>
					<DataTemplate>
						<Border
							Margin="6"
							>
							<ContentPresenter Content="{Binding}"/>
						</Border>
					</DataTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<BooleanToVisibilityConverter x:Key="boolVisibilityConverter"/>
	</UserControl.Resources>
	<Grid>
		<ScrollViewer>
			<StackPanel>
				<Expander Header="Statistics" IsExpanded="True" HorizontalAlignment="Left">
					<ListView
						ItemsSource="{Binding StatisticItems}"
						kui:ListViewHelper.IsSortingEnabled="True"
						>
						<ListView.Resources>
							<Style TargetType="{x:Type ListViewItem}">
								<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
							</Style>
						</ListView.Resources>
						<ListView.View>
							<GridView>
								<GridViewColumn Header="Member Type" kui:ListViewHelper.SortPropertyName="Label">
									<GridViewColumn.CellTemplate>
										<DataTemplate>
											<Grid>
												<Grid.ColumnDefinitions>
													<ColumnDefinition Width="Auto" SharedSizeGroup="icon"/>
													<ColumnDefinition Width="Auto" SharedSizeGroup="label"/>
												</Grid.ColumnDefinitions>
												<Image Source="{Binding Icon}" Stretch="Uniform" StretchDirection="Both" Width="16"/>
												<TextBlock Grid.Column="1" Text="{Binding Label}" Margin="2"/>
											</Grid>
										</DataTemplate>
									</GridViewColumn.CellTemplate>
								</GridViewColumn>
								
								<GridViewColumn Header="Public Count"  kui:ListViewHelper.SortPropertyName="PublicCount">
									<GridViewColumn.CellTemplate>
										<DataTemplate>
											<TextBlock Text="{Binding PublicCount, StringFormat={}{0:N0}}" TextAlignment="Right"/>
										</DataTemplate>
									</GridViewColumn.CellTemplate>
								</GridViewColumn>
								
								<GridViewColumn Header="Non-Public Count" kui:ListViewHelper.SortPropertyName="NonPublicCount">
									<GridViewColumn.CellTemplate>
										<DataTemplate>
											<TextBlock Text="{Binding NonPublicCount, StringFormat={}{0:N0}}" TextAlignment="Right"/>
										</DataTemplate>
									</GridViewColumn.CellTemplate>
								</GridViewColumn>
								
								<GridViewColumn Header="Total Count" kui:ListViewHelper.SortPropertyName="TotalCount">
									<GridViewColumn.CellTemplate>
										<DataTemplate>
											<TextBlock Text="{Binding TotalCount, StringFormat={}{0:N0}}" TextAlignment="Right"/>
										</DataTemplate>
									</GridViewColumn.CellTemplate>
								</GridViewColumn>
							</GridView>
						</ListView.View>
					</ListView>
				</Expander>

				<Expander
					HorizontalAlignment="Left"
					Header="XML Namespaces"
					IsExpanded="True"
					Visibility="{Binding HasXmlnamespaceItems, Converter={StaticResource boolVisibilityConverter}}"
					>
					<ListView
						ItemsSource="{Binding XmlNamespaceItems}"
						kui:ListViewHelper.IsSortingEnabled="True"
						>
						<ListView.View>
							<GridView>
								<GridViewColumn Header="Prefix" DisplayMemberBinding="{Binding Alias}" kui:ListViewHelper.SortPropertyName="Alias"/>
								<GridViewColumn Header="XML Namespace" DisplayMemberBinding="{Binding XmlNamespace}" kui:ListViewHelper.SortPropertyName="XmlNamespace"/>
								<GridViewColumn Header="CLI Namespace" DisplayMemberBinding="{Binding CliNamespace}" kui:ListViewHelper.SortPropertyName="CliNamespace"/>
							</GridView>
						</ListView.View>
					</ListView>
				</Expander>
			</StackPanel>
		</ScrollViewer>
	</Grid>
</UserControl>
